package com.newland.esp.controller.goods;

import com.newland.esp.common.util.DataResult;
import com.newland.esp.service.goods.GoodsInfoService;
import com.newland.esp.vo.response.goods.GoodsInfoSearchVO;
import com.newland.esp.vo.response.user.AdminInfoSearchVO;
import com.newland.esp.vo.response.user.TableDataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @param
 * @author lw
 * @descripe
 * @date 2021/10/27 21:58
 * @Version 1.0
 **/
@RestController
@CrossOrigin
@RequestMapping("/goods")
public class GoodsInfoController {
    @Autowired
    GoodsInfoService goodsInfoService;

    @GetMapping("/list")
    public TableDataVO list(Integer page, Integer limit, GoodsInfoSearchVO goodsInfoSearchVO){
        return goodsInfoService.findGoodsByPage(page, limit,goodsInfoSearchVO);
    }
    @GetMapping("/category/list")
    public DataResult categoryList(){
        return goodsInfoService.categoryChildrenList();
    }
    @GetMapping("/attribute/list/{catId}")
    public DataResult attributeList(@PathVariable Short catId, String attrSel){
        return goodsInfoService.attributeList(catId,attrSel);
    }
}
